package klass.parse.domain.constant;

import java.util.List;

public class ConstantClassInfo extends PostProcessConstant {
    private int refIndex;
    private ConstantUtf8Info classNameRef;

    public ConstantClassInfo(int refIndex) {
        this.refIndex = refIndex;
    }

    public ConstantUtf8Info getClassNameRef() {
        return classNameRef;
    }

    public void setClassNameRef(ConstantUtf8Info classNameRef) {
        this.classNameRef = classNameRef;
    }

    @Override
    public void finish(List<Constant> constants) {
        classNameRef = (ConstantUtf8Info) constants.get(refIndex);
    }

    @Override
    public short getTypeCode() {
        return 7;
    }

    @Override
    public String getTypeName() {
        return "Class";
    }

    @Override
    public String getRawString() {
        return "#" + refIndex;
    }

    @Override
    public String toString() {
        return classNameRef.toString();
    }
}
